package com.springboot.onlinemusicserver.controller;

import com.springboot.onlinemusicserver.service.UserService;
import com.springboot.onlinemusicserver.utils.common.Result;
import com.springboot.onlinemusicserver.utils.req.UserLoginParam;
import com.springboot.onlinemusicserver.utils.req.UserRegisterParam;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description :
 * User: jiume
 * Date: 2025-05-18
 * Time: 19:02
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    // 用户登录接口
    @PostMapping("/login")
    public Result<Boolean> userLogin(@RequestBody UserLoginParam userLoginParam,
                                     HttpServletRequest request) {
        return userService.userLogin(userLoginParam, request);
    }


    // 用户注册接口
    @PostMapping("/register")
    public Result<Boolean> userRegister(@RequestBody UserRegisterParam userRegisterParam) {
        return userService.userRegister(userRegisterParam);
    }


}
